{% load misago_shorthands %}
<li class="list-group-item list-group-category-{{ category.description|yesno:'has,no' }}-description {{ first|iftrue:'list-group-item-first' }} {% if category.css_class %}list-group-category-has-flavor list-group-item-category-{{ category.css_class }}{% endif %}">
  <div class="row">
    <div class="col-xs-12 col-sm-6 col-md-6 category-main">
      <div class="media">
        <div class="media-left">
          {% include "misago/categories/icon.html" %}
        </div>
        <div class="media-body">
          <h4 class="media-heading">
            <a href="{{ category.get_absolute_url }}">
              {{ category }}
            </a>
          </h4>
          {% if category.description %}
            <div class="category-description">
              {{ category.description|force_escape|urlize|linebreaks }}
            </div>
          {% endif %}
        </div>
      </div>
    </div>
    {% include "misago/categories/stats.html" %}
    {% include "misago/categories/last_thread.html" %}
  </div>
  {% if category.subcategories and not first %}
    <div class="row subcategories-list">
      {% for subcategory in category.subcategories %}
        <div class="col-xs-12 col-sm-4 col-md-3">
          <a class="btn btn-default btn-block btn-sm btn-subcategory {{ subcategory.is_read|iffalse:'btn-subcategory-new' }}" href="{{ subcategory.get_absolute_url }}">
            <span class="material-icon">
              {% if category.is_closed %}
                {% if category.is_read %}
                  lock_outline
                {% else %}
                  lock
                {% endif %}
              {% else %}
                {% if category.is_read %}
                  chat_bubble_outline
                {% else %}
                  chat_bubble
                {% endif %}
              {% endif %}
            </span>
            <span class="icon-text">
              {{ subcategory }}
            </span>
          </a>
        </div>
      {% endfor %}
    </div>
  {% endif %}
</li>